import java.util.Scanner;

public class TestDemo {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        try {
            int a = scanner.nextInt();
            System.out.println(10/a);
            System.out.println("aaaaaaaaaaa");
        }catch (ArithmeticException e){
            System.out.println("捕获到算术异常！！");
            e.printStackTrace();
        }finally {
            scanner.close();
            System.out.println("关闭资源");
        }
        System.out.println("最后！");
    }

    public static void main3(String[] args) {
        String str = "abc";
        str += "def";
        System.out.println(str);
    }

    public static void main2(String[] args) {
        StringBuffer stringBuffer = new StringBuffer("hello"); // 是线程安全的
        stringBuffer.append("????").append("world");
        System.out.println(stringBuffer);

        StringBuilder stringBuilder = new StringBuilder("hello"); // 不是线程安全的
        stringBuilder.append("world").append("!!!!");
        System.out.println(stringBuilder);
    }

    public static void main1(String[] args) {
        StringBuffer stringBuffer = new StringBuffer("hello");
        stringBuffer.reverse();
        System.out.println(stringBuffer); // olleh
    }
}
